<template>
    <view>
        <!-- components/webView/webView.wxml -->
        <!-- #ifdef MP-WEIXIN || APP-PLUS -->
        <web-view :src="linkMallUrl"></web-view>
        <!-- #endif -->
        <view v-if="status == 1">
            <web-view v-if="status == 1" :src="url"></web-view>
        </view>
        <view v-if="status == 2">
            <view class="imagesize">
                <image class="upgrading" src="https://oos-cn.ctyunapi.cn/front-end/static/static/activityStart.png" mode=""></image>
            </view>
            <view class="txt">
                <view class="txt1">
                    活动开始时间
                    <text class="fromDate">{{ time }}</text>
                    敬请期待！
                </view>
            </view>
        </view>
        <view v-if="status == 3">
            <view class="imagesize">
                <image class="upgrading" src="https://oos-cn.ctyunapi.cn/front-end/static/static/activityOver.png" mode=""></image>
            </view>
            <view class="txt">
                <view class="txt1">哎呀！来晚了，活动结束了~</view>
            </view>
        </view>
    </view>
</template>

<script>
	'use strict'; // components/webView/webView.ts
	var find_1 = require('../../api/find.js');
	export default {
		data() {
			return {
                linkMallUrl: undefined,
				url: undefined,

				// url: '',
				status: 0,
				time: '',
				id:'',
        type:''
			};
		}
		/**
		 * 生命周期函数--监听页面加载
		 */,
		onLoad: function (options) {
			console.log(`🚀 ~ file: webView.vue ~ options`, options)
			console.log(`🚀 ~ file: webView.vue ~ options.link`, options.link)
			this.url = options.link
            
            // 获取当前时间的时间戳
            let timeStamp = new Date().getTime();
            //积分商城url拼接
            this.linkMallUrl = `${options.link}?token=${uni.getStorageSync('token')}&t=${timeStamp}`
            console.log('goIntegralMall===>', this.linkMallUrl)


			this.id = options.id
			this.type = options.type
			if(this.type === 'active2'){
				this.getFindRead2(this.id);
			}
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function () {},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function () {},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function () {},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function () {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function () {},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function () {},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function () {},
		methods: {
			getFindRead2: function (id) {
				find_1.addReadNumber(id).then(function (res) {
					if (res.code == 0) {
						console.log(res);
					}
				});
			}
		}
	};
</script>
<style lang="less">
    @import url(../../commin/commin.less);  /* components/webView/webView.wxss */
    .imagesize {
        display: flex; /*flex布局*/
        height: 900rpx; /*flex布局高度*/
        justify-content: center;
        align-items: center;

        .upgrading {
            width: 514rpx;
            height: 398rpx;
        }
    }

    .txt {
        margin-top: -190rpx;
        display: flex;
        flex-direction: column;
    }

    .txt1 {
        text-align: center;
        font-size: 22rpx;
        font-family: PingFang SC;
        font-weight: 500;
        color: @blue;
        margin-bottom: 38rpx;
        .fromDate {
            font-size: 22rpx;
            color: @orange;
            font-family: PingFang SC;
            font-weight: 800;
            margin: 0 24rpx;
        }
    }

    .txt2 {
        text-align: center;
        font-size: 22rpx;
        font-family: PingFang SC;
        font-weight: 500;
        color: @text-color3;
    }
</style>
